commonlibsse_ng\re\h/hkMatrix3.rs
1use crate::re::hkVector4::hkVector4;
2
3/// Represents a 3x3 matrix in the Havok system.
4///
5/// This struct stores three `hkVector4` columns, where each column represents a 4D vector
6/// (x, y, z, w), though typically only the first three components (x, y, z) are used for 3x3 matrix operations.
7///
8/// # Memory Layout:
9/// - `col0`: First column vector (0x00 - 0x0F)
10/// - `col1`: Second column vector (0x10 - 0x1F)
11/// - `col2`: Third column vector (0x20 - 0x2F)
12#[repr(C)]
13#[derive(Debug, Clone, Copy)]
14pub struct hkMatrix3 {
15 /// First column of the matrix.
16 /// - Offset: 0x00
17 pub col0: hkVector4,
18
19 /// Second column of the matrix.
20 /// - Offset: 0x10
21 pub col1: hkVector4,
22
23 /// Third column of the matrix.
24 /// - Offset: 0x20
25 pub col2: hkVector4,
26}
27
28// Compile-time memory layout verification
29const _: () = {
30 assert!(core::mem::offset_of!(hkMatrix3, col0) == 0x0);
31 assert!(core::mem::offset_of!(hkMatrix3, col1) == 0x10);
32 assert!(core::mem::offset_of!(hkMatrix3, col2) == 0x20);
33 assert!(core::mem::size_of::<hkMatrix3>() == 0x30);
34};
35
36impl hkMatrix3 {
37 /// Creates a new `hkMatrix3` with all components set to zero.
38 #[inline]
39 pub fn new() -> Self {
40 Self { col0: hkVector4::new(), col1: hkVector4::new(), col2: hkVector4::new() }
41 }
42}
43
44impl Default for hkMatrix3 {
45 #[inline]
46 fn default() -> Self {
47 Self::new()
48 }
49}